#include<stdio.h>

/*第十课：隐式转换和强制转换*/

int main()
{ 
    //隐式转换
    int a = 10;
    float b = 20.0;
    float c = a + b;
    printf("%f\n",c);
    printf("%zu\n",sizeof(c));

    short d =12;
    short e = -5;
    short f = d + e;
    printf("%d\n",f);
    printf("%zu\n",sizeof(f));

    //强制转换
    short n1 =10;
    short n2 = -5;
    short n3 = (short)(n1 + n2);
    printf("%d\n",n3);
    printf("%zu\n",sizeof(n3));

    char i = 'a';
    int j = i+1;
    printf("输出整型变量：%d\n",j);//根据ASCII码，a被转换成了97，97+1=98
    printf("输出字符串：%c\n",j);//根据ASCII码，98被转换成了b

    return 0;
}